import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        for (int i = 31; i >= 1 ; i-=2) {
            System.out.print(((n>>>i) & 1) + " " );
        }
        System.out.println();
        for (int i = 30; i >= 0 ; i-=2) {
            System.out.print(((n>>>i) & 1) + " " );
        }//获取一个数的二进制序列中的奇数位或者偶数位
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);


        int key = 678678;

        for (int count = 3; count > 0 ; count--) {
            System.out.println("请输入你的密码");
            int cry = scanner.nextInt();
            if(key != cry)
            {
                System.out.println("密码错误，请重新输入");
            }else {
                System.out.println("密码正确，登陆成功");
                break;
            }
        }
    }//模拟登录
    public static void main1(String[] args) {
        int a = 82476;
        while(a > 10){
            System.out.println(a%10);
            a /= 10;
        }
        System.out.println(a);
    }//求一个数的每一位
    public static void NineNine(String[] args) {
        for (int i = 1; i < 10; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i + "*" + j +"=" +i*j+" ");
            }
            System.out.println();
        }
    }//99乘法表
    public static void nine(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100 ; i++) {
            int a = i%10;
            if(a==9){
                count++;
            }
            int b =i/10;
            if(b == 9){
                count++;
            }

        }System.out.println(count);
    }//计算100内的数字包含多少个数字0

    public static boolean IsLeapYear(int x) {
        if(x % 4 == 0 && x % 100 !=0 || x%400 ==0 ){
            return true;
        }
        else
            return false;
    }//判断闰年

    public static void prime(String[] args) {
        for (int i = 2; i < 100; i++) {

            int key = 1;
            for (int j = 2; j < i; j++) {
                if(i%j==0)
                {
                    key = 0;
                }
            }
            if(key == 1){
                System.out.println(i);
            }
        }
    }
        //100内的质数
    public static boolean Isprime (int x) {
        if(x<2){
            return  false;
        }
        for (int i = 2; i <= x/2; i++) {
            if(x%i==0)
            {
                return false;
            }
        }
        return true;
    }//判断一个数是否是质数
}
